import { message } from 'ant-design-vue'
import axios from 'axios'

const http = axios.create({
  timeout: 2000
  // baseURL: 'http://localhost:3000'
})

http.interceptors.request.use(config => {
  config.headers.Authorization = localStorage.getItem('token')
  return config
})

http.interceptors.response.use(res => {
  // if (res.status === 200) {
  //   return res
  // } else if (res.status === 404) {
  //   message.error('接口找不到')
  // }
  return res
})

export default http
